package week04;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class PersonOverride
{
	private String name;
	private int age;
	private boolean gender;
	
	public PersonOverride()
	{
		this("default",1,true);
	}
	
	public PersonOverride(String name, int age, boolean gender) {
		super();
		this.name = name;
		this.age = age;
		this.gender = gender;
	}
	
	@Override
	public String toString() {
		return name + "-" + age +"-" + gender;
	}
	
	@Override
	public boolean equals(Object obj) {
		PersonOverride other = (PersonOverride) obj;
		if (age==other.age && gender==other.gender && name.equals(other.name))
		   return true;
		else 
			return false;
	}
}
public class Main1
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int m=Integer.parseInt(in.nextLine());
		int n=Integer.parseInt(in.nextLine());
		PersonOverride[] person1=new PersonOverride[m];
		for (int i = 0; i < person1.length; i++) {
			person1[i]=new PersonOverride();
		}
		ArrayList<PersonOverride> person2=new ArrayList<PersonOverride>();
		for (int i = 0; i < n; i++) {
			String[] str=in.nextLine().split(" ");
			PersonOverride wb=new PersonOverride(str[0],Integer.parseInt(str[1]),Boolean.parseBoolean(str[2]));
			if(i==0)
				person2.add(wb);
			else
			{
				for (int j=0;j<person2.size();j++) {
					boolean b=wb.equals(person2.get(j));
					if(b!=true)
						person2.add(wb);
				}
			}
		}
		for (int i = 0; i < person1.length; i++) {
			System.out.println(person1[i]);
		}
	    for (int i = 0; i < person2.size(); i++) {
			System.out.println(person2.get(i));
		}
		System.out.println(person2.size());
		System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
	}
}